explorer Lidar et R pour les arbres
https://r-lidar.github.io/lidRbook/io.html
et surtout en très clair
https://orbi.uliege.be/bitstream/2268/307897/5/R_GIS_04_lidR.pdf
On cherche d’abord la localisation x y précise des arbres
library(sf)
## Linking to GEOS 3.12.1, GDAL 3.8.4, PROJ 9.3.1; sf_use_s2() is TRUE
library(lidR)
##
## Attachement du package : 'lidR'
## L'objet suivant est masqué depuis 'package:sf':
##
## st_concave_hull
library(rgl)# pour visu 3d
library(mapsf)
library(leaflet)
library(mapview)
source : https://whitschroder.github.io/remote-sensing/lidr.html#cloth-simulation-function-csf
https://r-lidar.github.io/lidRbook/dtm.html
traduction rapide du manuel lidR
https://r-lidar.github.io/lidRbook/io.html
donnée position x y z intensité rang angle d’incidence
laz format compressé de las
l’objet est constitué de l’en tête et du nuage de point
Les fichiers de téléchargement sont lourds, on les met dans data/gros et on modifie le gitignore pour les exclure
Récupération des formes pour couper
zone <- st_read("data/zone.gpkg")
## Reading layer `zoneExtraction' from data source
## `C:\Users\tachasa\10_photosGPS\data\zone.gpkg' using driver `GPKG'
## Simple feature collection with 1 feature and 1 field
## Geometry type: POLYGON
## Dimension: XY
## Bounding box: xmin: 2.480062 ymin: 48.8885 xmax: 2.483405 ymax: 48.89035
## Geodetic CRS: WGS 84
mapview(zone)
zone <- st_transform(zone, 2154)
lasf <- dir("data/gros", "*.laz")
for (f in lasf) {
las <- readLAS(paste0("data/gros/",f), select = "xyz")
sel <- clip_roi(las, zone)
writeLAS(sel, paste0( "data/",f,".las"))
}
lasf <- dir("data/", "*.las")
sel <- readLAS(paste0("data/", lasf [1]))
sel1 <- readLAS(paste0("data/", lasf [2]))
tot <- rbind(sel, sel1)
writeLAS(tot, "data/gros/tot.las")
Tous les points sont à zéro
tot <- readLAS("data/gros/tot.las")
# tous les points
df <- payload(tot)
table(df$Classification)
library(ggplot2)
ggplot(payload(tot), aes(X,Z, color = Z)) +
geom_point(size = 0.5) +
coord_equal() +
theme_minimal() +
scale_color_gradientn(colours = height.colors(50))
tot <- readLAS("data/gros/tot.las")
plot(tot, bg="white")
rglwidget()